﻿using SXICE.Core.Domains;
using SXICE.Core.Models;
using SXICE.Core.Models.Search;
using SXICE.IRepository;
using SXICE.IService;
using System;
using System.Collections.Generic;
using System.Text;

namespace SXICE.Service
{
    /// <summary>
    /// 权限菜单服务
    /// </summary>
    public class MenuService : IMenuService
    {
        private readonly IMenuRepository menuRepository;

        public MenuService(IMenuRepository menuRepository)
        {
            this.menuRepository = menuRepository;
        }

        public ReturnResult<bool> AddMenu(Menu menu)
        {
            return menuRepository.InsertOne(menu);
        }

        public ReturnResult<bool> Delete(int id)
        {
            return menuRepository.Delete(id);
        }

        public ReturnPageListResult<Menu> Search(PageListQuery<RecordSearchModel> pageListQuery)
        {
            return menuRepository.Search(pageListQuery);
        }

        public ReturnResult<List<Menu>> Search()
        {
            return menuRepository.Search();
        }
    }
}